from selenium.webdriver.common.by import By

class UserMyResourceLocator:

    """
        20240416新增
    """
    # 等待转菊花
    wait_for_pay = (By.CSS_SELECTOR, '[class="antd4-spin-dot antd4-spin-dot-spin"]')
    # status筛选按钮
    click_status = (By.XPATH,'//*[text()="Status"]/../span[@role="button"]')
    # vaild 选项
    select_vaild = (By.XPATH,'//*[text()="Valid"]/ancestor::li')
    # reset
    click_status_reset = (By.XPATH,'//*[text()="Valid"]/ancestor::div[@class="antd4-table-filter-dropdown"]//*[text()="Reset"]/..')
    # ok
    click_status_ok = (By.XPATH,'//*[text()="Valid"]/ancestor::div[@class="antd4-table-filter-dropdown"]//*[text()="OK"]/..')


    # 进入My Resource菜单
    my_resource_menu = (By.CSS_SELECTOR, '[path="/work_bench/myResource"]')
    # Orgnazation选择框
    # orgnazation_select = (By.XPATH, '(//div[contains(@class,"antd4-select-selector")])[2]')
    orgnazation_select = (By.XPATH, '//*[@id="orgCode"]/..')

    #Orgnazation下拉框第一个选择项
    orgnazation_input = (By.XPATH, '//span[text() = "sdaaaaaaaaaaaaaaa"]')
    #Orgnazation下拉第二个选项
    organazation_input2 = (By.XPATH, '(//span[contains(@class,"antd4-select-tree-title")])[2]')
    #search按钮
    orgnazation_search = (By.XPATH, '//span[text() = "Search"]')
    #orgnazation第一个结果
    orgnazation_result = (By.XPATH, '(//div[contains(@class,"cre-table-nowrap")])[4]')

    # 当前展示月份选择start time和end time
    start_time_select = (By.XPATH, "//input[contains(@placeholder,'Start date')]")
    end_time_select = (By.XPATH, "//input[contains(@placeholder,'End date')]")
    #第一个搜索时间结果
    first_expired_time_result = (By.XPATH, '(//div[contains(@class,"expireTimeContainer")])[1]')



    #搜索框选项
    search_select = (By.XPATH, '(//div[contains(@class,"antd4-select-selector")])[1]')
    #Instance ID输入框
    instance_id_input = (By.XPATH, "//input[contains(@placeholder,'Search by instance ID')]")
    # Product Name选择框
    product_name_select = (By.XPATH, '(//div[contains(@class,"antd4-select-item-option-content")])[2]')
    # Instance id选择框
    instance_id_select = (By.XPATH, '(//div[contains(@class,"antd4-select-item-option-content")])[1]')
    # produc Name输入框
    product_name_input = (By.ID, 'offerId')
    #product name第一个选择结果
    first_product_name_select = (By.XPATH, '(//div[contains(@class,"antd4-select-item antd4-select-item-option antd4-select-item-option-active")])[2]')
    #account email选择框
    account_email_select = (By.XPATH, '(//div[contains(@class,"antd4-select-item-option-content")])[3]')
    #account email输入框
    account_email_input = (By.XPATH, "//input[contains(@placeholder,'Search by account email')]")

    #instance id搜索结果第一个
    instance_id_result = (By.XPATH, '(//div[contains(@class,"cre-table-nowrap")])[1]')
    #product name搜索结果第一个
    product_name_result = (By.XPATH, "(//div[contains(@style,'white-space: nowrap')])[1]")
    #account email搜索结果第一个
    account_email_result = (By.XPATH, '(//div[contains(@class,"cre-table-nowrap")])[5]')

    #Region筛选框
    region_select = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-trigger antd4-table-filter-trigger")])[1]')
    #region筛选框内第一个
    region_first_select = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-menu-title-content")])[3]')
    #region ok按钮
    region_ok_button = (By.XPATH, '(//button[contains(@class,"antd4-btn antd4-btn-primary antd4-btn-sm")])[2]')
    #ok按钮
    ok_button = (By.XPATH, '(//button[contains(@class,"antd4-btn antd4-btn-primary")])[3]')
    #reset按钮
    reset_button= (By.XPATH, '//span[text() = "Reset"]')
    #Billing Method筛选框
    billing_method_select = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-trigger antd4-table-filter-trigger")])[2]')
    # Billing Method字段sub筛选项
    sub_select = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-menu-title-content")])[1]')
    # Billing Method字段PYG筛选项
    pyg_select = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-menu-title-content")])[2]')

    # expired time 排序按钮
    expired_time_sort_button = (By.XPATH, '(//div[contains(@class,"antd4-table-column-sorters")])[2]')
    # 当前列表第一行
    list_first_line = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]')
    # expired time列
    expired_time = (By.CSS_SELECTOR, '[class="antd4-table-row antd4-table-row-level-0"]>:nth-child(7)>div')

    # create time 排序按钮
    create_time_sort_button = (By.XPATH, '(//div[contains(@class,"antd4-table-column-sorters")])[1]')
    # create time列
    create_time = (By.CSS_SELECTOR, '[class="antd4-table-row antd4-table-row-level-0"]>:nth-child(6)>div')


    # region列
    region_list = (By.CSS_SELECTOR, '[class="antd4-table-row antd4-table-row-level-0"]>:nth-child(3)>div')
    # product列
    product_list = (By.CSS_SELECTOR, '[class="antd4-table-row antd4-table-row-level-0"]>:nth-child(2)>div')
    # billing method列
    billing_method_list = (By.CSS_SELECTOR, '[class="antd4-table-row antd4-table-row-level-0"]>:nth-child(4)>div')


    #disable Auto-renewal按钮
    disable_auto_renewal_button = (By.XPATH, '(//button[contains(@class,"antd4-switch antd4-switch-checked")])[1]')
    #按钮关闭显示
    button_result = (By.XPATH, '(//span[contains(@class,"antd4-switch-inner")])[1]')
    # ensable Auto-renewal按钮
    enable_auto_renewal_button = (By.XPATH, '(//button[contains(@class,"antd4-switch")])[1]')
    # Auto-renewal Validity Period选择框
    renewal_period = (By.XPATH, '(//div[contains(@class,"antd4-select-selector")])[4]')
    # Auto-renewal Validity Period下拉第一个选项
    renewal_period_first_select = (By.XPATH, '(//div[contains(@class,"antd4-select-item antd4-select-item-option")])[1]')
    #下一页
    next_page = (By.XPATH, '(//button[contains(@class,"antd4-pagination-item-link")])[2]')

    # traffic monitor按钮
    traffic_monitor_button = (By.XPATH, '(//div[contains(@class,"antd4-switch")])[1]')
    # Edit Traffic Usage Notification界面，usage notication按钮
    usage_notification_button = (By.ID, 'creForm_state')
    # Notification Threshold输入框
    notification_threshold_input = (By.ID, 'creForm_threshold')
    # Notification User List输入框
    notification_user_list_input = (By.ID, 'creForm_noticeUsers')
    # Notification User List下拉第一个选择
    notification_user_list_result = (By.XPATH, '(//div[contains(@class,"antd4-select-item antd4-select-item-option antd4-select-item-option-active")])[3]')
    #结果悬浮
    percentage_of_progress = (By.XPATH, '(//div[contains(@class,"trafficUsed")])[1]')
    #结果展示
    result_monitor = (By.XPATH, '(//div[contains(@class,"antd4-tooltip-inner")])[1]')
    #关闭按钮
    close_traffic_monitor_button = (By.XPATH, '(//span[contains(@class,"anticon anticon-edit editIcon___wq_9O pointer___1TmUI")])[1]')
    #Statistical Period选择框
    statistical_period_select = (By.XPATH, '(//div[contains(@class,"antd4-select-selector")])[5]')
    #Statistical Period第二个选项
    statistical_period_sencond = (By.XPATH, '(//div[contains(@class,"antd4-select-item antd4-select-item-option")])[6]')

    #traffic monitor N
    traffic_monitor_n = (By.XPATH, '(//span[contains(@class,"antd4-switch-inner")])[1]')

    #第一行experiod time修改按钮
    edit_expired_time = (By.XPATH, '(//span[contains(@class,"anticon anticon-edit editIcon___3kg65 pointer___33hgN")])[1]')
    #expired time输入
    input_expired_time = (By.ID, 'expireTime')
    #actions按钮
    actions_button = (By.XPATH, '(//div[contains(@class,"antd4-dropdown-trigger table-operation-omit")])[1]')
    #change organization按钮
    change_organization_button = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-menu-title-content")])[3]')
    #change organization选择框
    change_organization_select = (By.XPATH, '(//div[contains(@class,"antd4-select-selector")])[4]')
    #chang organization下拉选择
    change_organization_first_select = (By.XPATH, '(//span[contains(@class,"antd4-select-tree-node-content-wrapper antd4-select-tree-node-content-wrapper-open")])[1]')
    change_organization_second_select = (By.XPATH, '(//span[contains(@class,"antd4-select-tree-node-content-wrapper antd4-select-tree-node-content-wrapper-normal")])[1]')
    # submit按钮
    submit_button = (By.XPATH, '//span[text() = "Submit"]')
    # change orgnization操作成功
    change_organization_success = (By.XPATH, '(//div[contains(@class,"antd4-message-custom-content antd4-message-success")])[1]')
    # orgnization 第一行展示
    second_orgnization = (By.XPATH, '(//div[contains(@class,"cre-table-nowrap")])[4]')

    #modify expired time title
    modify_expired_time_title = (By.XPATH, '(//div[contains(@class,"antd4-modal-title")])[1]')
    #ok按钮
    #modify_expired_time_ok_button = (By.XPATH, '(//button[contains(@class,"antd4-btn antd4-btn-primary")])[4]')
    modify_expired_time_ok_button = (By.XPATH, '//*[@id="expireTime"]/ancestor::div[@class="antd4-modal-content"]//*[text()="OK"]/..')
    #修改界面instance id
    #modify_page_instance_id = (By.XPATH, '(//div[contains(@class,"antd4-form-item-control-input-content")])[4]')
    modify_page_instance_id = (By.XPATH, '(//*[@id="expireTime"]/ancestor::div[@class="antd4-modal-content"]//*[@class="antd4-form-item-control-input-content"])[1]')
    #确认时间
    time_filter = (By.XPATH, '(//td[contains(@class,"antd4-picker-cell antd4-picker-cell-in-view antd4-picker-cell-selected")])[1]')

    # 列表字段
    Instance_ID = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[1]')
    Product_Name = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[2]')
    Region = (By.XPATH, '(//span[contains(@class,"antd4-table-column-title")])[1]')
    Billing_Method = (By.XPATH, '(//span[contains(@class,"antd4-table-column-title")])[2]')
    Created_Time = (By.XPATH, '(//span[contains(@class,"antd4-table-column-title")])[3]')
    Expired_Time = (By.XPATH, '(//span[contains(@class,"antd4-table-column-title")])[4]')
    Product_Type = (By.XPATH, '(//span[contains(@class,"antd4-table-column-title")])[5]')
    Status = (By.XPATH, '(//span[contains(@class,"antd4-table-column-title")])[6]')
    traffic_monitor = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[5]')
    Enable_Auto_renewal = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[10]')
    auto_renewal_alidity_period = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[11]')
    Auto_Scaling = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[12]')
    Oraganization = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[13]')
    Account_Email = (By.XPATH, '(//th[contains(@class,"antd4-table-cell")])[14]')

    # renewal status 问号
    renewal_status_note_button = (By.XPATH, '(//span[contains(@class,"anticon help___1Jtx3")])[1]')
    # renewal status 问号的note
    renewal_status_note1 = (By.XPATH,
                            '//div[text() = "If you enable the Auto-renewal, the instance will be automatically renewed 24 hours before it expires."]')
    renewal_status_note2 = (By.XPATH,
                            '//div[text() = "System will automatically charge and renew subscription instances according to auto-renewal validity period each time."]')

    # renewal status字段
    renewal_status = (By.XPATH, '(//div[contains(@class,"helpWrap___1cl-R")])[1]')

    # renewal status按钮
    renewal_status_button = (By.XPATH, '(//button[contains(@class,"antd4-switch")])[1]')

    # validity period字段
    validity_period = (By.XPATH, '//th[text() = "src.pages.product.purchase.renew.auto.renew.validity.period"]')

    renewal_status_YN = (By.XPATH, '(//span[contains(@class,"antd4-switch-inner")])[1]')

    create_time_now = (By.XPATH, '(//div[contains(@class,"cre-table-nowrap")])[2]')
    expired_time_now = (By.XPATH, '(//div[contains(@class,"expireTimeContainer___3F-nr")])[1]')

    orders_mene = (By.XPATH, '(//div[contains(@class,"cre-menu-layer-2")])[3]')
    renew_order_type = (By.XPATH, '(//div[contains(@class,"cre-table-nowrap")])[2]')

    auto_renew_edit_button = (By.XPATH, '(//span[contains(@class,"anticon anticon-edit editIcon___3kg65 pointer___33hgN")])[1]')
    new_renew_select_button = (By.XPATH, '(//div[contains(@class,"antd4-select-selector")])[5]')
    new_renew_second_choose = (By.XPATH, '(//div[contains(@class,"antd4-select-item antd4-select-item-option")])[5]')
    renew_period_list = (By.XPATH, '(//td[contains(@class,"antd4-table-cell")])[26]')

    # 续费按钮
    renew_button= (By.XPATH, '//span[text() = "Renew"]')
    # 释放按钮
    release_button = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-menu-title-content")])[2]')
    # 变配按钮
    modify_button = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-menu-title-content")])[1]')

    #renew界面贺modify界面查看组织
    renew_modify_page_organization = (By.XPATH, '(//span[contains(@class,"antd4-descriptions-item-content")])[1]')

    #release界面查看组织
    release_page_organization = (By.XPATH, '(//div[contains(@class,"cre-table-nowrap")])[1]')

    #TDS控制台title
    TDS_title = (By.XPATH, '(//div[contains(@class,"cre-sider-menu-header")])[1]')
    # SLB购买页面title
    slb_page_title = (By.XPATH, '(//div[contains(@class,"product-title___YYoNb")])[1]')












